/*
 Selectors Level 3: http://www.w3.org/TR/css3-selectors/#selectors
 CSS selectors mobile table: http://www.quirksmode.org/css/selectors/mobile.html
 Can I use CSS3 selectors? http://caniuse.com/css-sel3
*/

/*
  http://mobilehtml5.org/
*/

/*

 1. border-radius without vendor prefix? >= Android 2.2 iOS 4.0 @see http://css3please.com/
 2. position:fixed? >= Android 2.3(Android 2.3 supports fixed positioning, but disabling page scaling is required.) iOS 5.0
  @see http://caniuse.com/#search=fixed
  @see http://bradfrostweb.com/blog/mobile/fixed-position/
 3. -webkit-overflow-scrolling: touch? >= Android 4.0 iOS 5.0

*/

/*
1. Why not use shorthand property with border-radius?
 The stock browser on the Samsung Galaxy S4 with Android 4.2 does not support the "border-radius" shorthand property
 but does support the long-hand properties for each corner like "border-top-left-radius"
 @see http://stackoverflow.com/questions/17186158/galaxy-s4-stock-browser-css3-border-radius-support.

 */


/* Normalize */

html, body, ul, ol, img, p, input, button {
    margin: 0;
    padding: 0;
}

html, body {
    font-family: -apple-system-font, "Helvetica Neue", Helvetica, STHeiTi, sans-serif;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

/* Removes webkit border when the element is on focus */
a, a:active, a:focus,
button, button:active,
input, input:focus,
select, select:focus,
textarea, textarea:focus {
    outline: none;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
}

a {
    text-decoration: none;
    color: #0079FF;
}

ol, ul  {
    list-style: none;
}

/* /Normalize */

/* Skeleton */

.ui-app {
    /* TODO */
    background-color: rgb(240, 240, 240);
}

.ui-app * {
    -webkit-touch-callout: none;

    -webkit-tap-highlight-color: rgba(0,0,0,0);
    -webkit-tap-highlight-color: transparent; /* For some android devices */

    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

.ui-top-bar, .ui-bottom-bar {
    /* hairline, using a 1x2px image */
    background-image: url();
    background-repeat: repeat-x;
    background-color: rgb(250, 250, 250);
    background-size: 100% 1px; /* Scale image by background-size */

    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    text-align: center;
    z-index: 3;

    height: 48px;
}

.ui-flexbox, .ui-bottom-bar {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
}

.ui-top-bar {
    top: 0;
    background-position: bottom left;
}

.ui-bottom-bar {
    bottom: 0;
    background-position: top left;
}

/* Bottom-bar under the app node */
.ui-bottom-bar ~ .ui-page > .ui-page-content {
    /*margin-bottom: 50px;*/
    border-bottom: 48px solid transparent;
}

/* Top-bar under the app node */
.ui-top-bar ~ .ui-page > .ui-page-content {
    /*margin-top: 50px;*/
    border-top: 48px solid transparent;
}

.ui-page {
    display: none;
    /* TODO Why page is absolute? performance mater */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;

    overflow: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 2;
}

.ui-page.js-active {
    display: block;
}

.ui-page-content {
    z-index: 2;
}

.js-no-overflow-scrolling .ui-page {
    position: static;
}

/* /Skeleton */

/* Bottom Bar */

.ui-bottom-bar-button {
    border: none;
    outline: none;

    padding: 2px 0;
    background-color: transparent;
    color: rgb(111, 111, 116);

    text-align: center;
}

.ui-flex-1, .ui-bottom-bar-button {
    /* Hack flex box not work on some android devices like Xiaomi 2 */
    display: block;
    /* Avoid use margin under the flex box element */
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
}

.ui-bottom-bar-button .ui-icon {
    display: block;
    background-color: transparent;

    color: rgb(111, 111, 116);
    font-size: 24px;
    text-align: center;
    padding: 2px 0;
}

.ui-bottom-bar-button .ui-label {
    display: block;
    font-size: 12px;
    line-height: 12px;
    padding: 2px 0;
}

.ui-bottom-bar-button.js-active {
    color:rgb(21, 125, 251);
}

.ui-bottom-bar-button.js-active .ui-icon {
    color:rgb(21, 125, 251);
}

/* /Bottom Bar */


/* Utils */

@media screen and (-webkit-min-device-pixel-ratio: 2) {
    .ui-1dpx-t, .ui-1dpx-b, .ui-1dpx-tb {
        background-size: 100% 1px;
    }

    .ui-1dpx-t {
        background: -webkit-gradient(linear,left bottom,left top,color-stop(.5,rgba(0, 0, 0, 0)),color-stop(.5,#C8C7CC),to(#C8C7CC))left top repeat-x;
        border-top: 0;
    }

    .ui-1dpx-b {
        background: -webkit-gradient(linear,left top,left bottom,color-stop(.5,rgba(0, 0, 0, 0)),color-stop(.5,#C8C7CC),to(#C8C7CC))left bottom repeat-x;
        border-bottom: 0;
    }

    .ui-1dpx-tb {
        background: -webkit-gradient(linear,left bottom,left top,color-stop(.5,rgba(0, 0, 0, 0)),color-stop(.5,#C8C7CC),to(#C8C7CC))left top repeat-x,-webkit-gradient(linear,left top,left bottom,color-stop(.5,rgba(0, 0, 0, 0)),color-stop(.5,#C8C7CC),to(#C8C7CC))left bottom repeat-x;
        border-top: 0;
        border-bottom: 0;
    }
}

.ui-ignore-space {
    font-size: 0;
}

.ui-no-wrap {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ui-red {
    color: rgb(250, 60, 60) !important;
}

.ui-gray {
    color: #808080 !important;
}

.ui-red-dot, .ui-blue-dot {
    width: 8px;
    height: 8px;
    border-radius: 8px;
}

.ui-red-dot {
    background: rgb(250, 60, 60) !important;
}

.ui-blue-dot {
    background: #0079FF !important;
}

.ui-right {
    float: right !important;
}

.ui-left {
    float: left !important;
}

.ui-block {
    display: block !important;
}

.ui-inline-block {
    display: inline-block !important;
}

.ui-red-counter, .ui-blue-counter  {
    position: absolute;
    top: -9px;
    right: -9px;

    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 4px;
    font-size: 13px;
    color: #FFF;

    text-align: center;

    z-index: 3;
    border-radius: 18px;
}

.ui-red-counter {
    background: rgb(250, 60, 60);
}

.ui-blue-counter {
    background: #2087fc;
}

/* /Utils */

/* Panel */
.ui-panel {
    margin-bottom: 20px;
    padding: 10px 12px;
    font-size: 15px;
    background: #FFF;
    border-style: solid;
    border-color: #e5e5eb;
    border-width: 1px 0 1px 0;
}
/* /Panel*/

/* Button */

.ui-button {
    display: inline-block;

    border-radius: 3px;
    padding: 6px 10px;
    margin: 4px 0;
    border: 1px solid #0079FF;
    color: #0079FF;
    font-size: 13px;
    line-height: 13px;
    text-align: center;
    background-color: transparent;

    -webkit-appearance: none;
    text-decoration: none;
    -webkit-box-sizing: border-box;
}

.ui-button:active {
    color: #fff;
    background: #0079FF;
}

.ui-button[disabled]{
    pointer-events: none;
    color: #a6a6a6;
    border-color: #a6a6a6;
    background: #fff;
    opacity: 0.6;
}

.ui-button.ui-block {
    height: 44px;
    padding: 10px;
    font-size: 17px;
    line-height: 17px;
    display: block;
    width: 100%;
}

.ui-info {
    color: white;
    background: #0079FF;
    border-color: #0079FF;
}

.ui-info:active {
    opacity: 0.4;
}

.ui-success {
    color: white;
    background: #46ca5e;
    border-color: #46ca5e;
}

.ui-success:active {
    background: #46ca5e;
    border-color: #46ca5e;
    opacity: 0.4;
}

.ui-danger {
     color: #fc4226;
     border-color: #fc4226;
}

.ui-danger:active {
    color: #fff;
    background: #fc4226;
}

/* /Button */

/* Group Button */

.ui-groupbutton {
    display: table;
    font-size: 1em;
    border-color: rgba(0, 0, 0, 0);
    white-space: nowrap;
    margin: 10px auto;
}

.ui-groupbutton .ui-button {
    display: table-cell;
    margin: 0;
    min-width: 70px;
    border-width: 1px 0 1px 1px;
    border-radius: 0;
    position: relative;
    float: left; /* Hack for iOS 4.3 that make position: relative work right */
}

.ui-groupbutton .ui-button:active {
    color: #0079FF;
    background-color: #D3E5F9;
}

.ui-groupbutton .ui-button.js-active {
    color: #fff;
    background: #0079FF;
}

.ui-groupbutton .ui-button:first-child {
    border-radius: 3px 0 0 3px;
    border-right-width: 0;
}

.ui-groupbutton .ui-button:last-child {
    border-radius: 0 3px 3px 0;
    border-width: 1px;
}

/* Gray Style */

.ui-groupbutton.ui-gray .ui-button{
    color: rgb(128, 128, 128);
    border-color: rgb(128, 128, 128);
}

.ui-groupbutton.ui-gray .ui-button:active {
    background-color: rgb(230, 230, 230);
}

.ui-groupbutton.ui-gray .ui-button.js-active {
    color: #fff;
    background: rgb(128, 128, 128);
}


/* /Group Button */

/* List */
.ui-caption {
    margin: 18px 0 5px;
    padding: 0 12px;
    line-height: 24px;
    font-size: 14px;
    color: #7c7b83;
    -wbkit-text-shadow: 0 1px rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px rgba(255, 255, 255, 0.2);
}

.ui-list {
    margin-bottom: 20px;
    padding-bottom: 1px;
    background: white;

    border-style: solid;
    border-color: #e5e5eb;
    border-width: 1px 0 1px 0;
}

.ui-item {
    position: relative;
    margin-left: 12px;

    list-style-type: none;

    font-weight: 500;
    font-size: 17px;
    line-height: 20px;
    color: #000;
}

.ui-item+.ui-item {
    border-top: 1px solid #e5e5eb
}

/* Link item */
.ui-item > a {
    display: block;
    position: relative;
    margin-left: -12px; /* Why negative value? parent element has marin-left 12px */
    padding: 10px 12px;
    color: #000;
}

.ui-item > a.js-active {
    z-index: 1;
    color: #fff;
    background: #2087fc;
}

.ui-item:after {
    position: absolute;
    z-index: 2;
    top: -1px;
    bottom: -1px;
    width: 42px;
    line-height: 42px;
    font-size: 32px;
    color: white;
    text-align: center;
}

.ui-item.deleting:after {
    content: "Delete";
    right: 0;
    line-height: 40px;
    background: #fd3c31;
}

.ui-item .ui-right {
    font-size: 14px;
    position: absolute;
    text-align: right;
    right: 34px;
}

.ui-item .ui-red-dot {
    position: absolute;
    top: 16px;
}

/*  A list-level or item-level class, cool? Yeah! */
.ui-list.arrow-right > .ui-item:after, .ui-item.arrow-right:after {
    color: #CCC;   /* This color some with border color */
    content: "";
    position: absolute;
    top: 21px;
    right: 20px;
    width: 7px;
    height: 7px;
    margin-top: -5px;
    border-style: solid;
    border-width: 2px 2px 0 0;
    -webkit-transform: rotate(45deg);
}

.ui-list.arrow-right > .ui-item.js-active:after, .ui-item.arrow-right.js-active:after {
    color: #fff;
}

.ui-list.icon-left .ui-icon {
    position: absolute;
    left: 8px;
    top: 6px;
    width: 25px;
    height: 25px;
}

.ui-list.icon-left > .ui-item {
    padding-left: 40px;
}

.ui-title-item {
    position: relative;
    padding: 0 12px;
    margin: 0;
    font-size: 14px;
    line-height: 26px;
    color: #000;
    background: #f5f5f5;
    border: 1px solid #e5e5eb;
    border-width: 1px 0;
    box-shadow: none
}

.ui-title-item:first-child {
    border-top-width: 0
}

/* /List */

/* SearchBar */

.ui-search {
    position: relative;
    background: #D5D5D5;
    padding:6px 8px;
    box-shadow: 0 1px rgba(0, 0, 0, 0.07), 0 1px 1px rgba(0, 0, 0, 0.05);

    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

.ui-search-form {
    background: #fff;
    width: 100%;
    display: block;
    border-radius: 4px;
    padding: 0 0 0 22px;
}

.ui-search-form:before {
    display: block;
    position: absolute;
    top: 12px;
    left: 12px;

    background: url(../img/icon-search.png?embed) no-repeat;
    background-size: 16px;
    width: 16px;
    height: 16px;
    content: "";
}

.ui-search-input {

    display: inline-block;
    height: 28px;
    width: 100%;
    background-color: transparent;
    border: 0;
    outline: 0;

    font-size: 14px;
    line-height: 16px;

    -webkit-appearance: none;

    /*
        Why not use -webkit-user-modify: read-write-plaintext-only to avoid input elements on android 4.x can not be styled when focused.
        I test on andorid 4.0.3 it's reset the default style when input focused, but this trigger another problem that user cannot input multi words.
        @see https://code.google.com/p/android/issues/detail?id=24746
    */

}

.ui-search-input::-webkit-input-placeholder{
    padding-top: 2px;
}

.ui-search-input::-webkit-search-cancel-button {
    display: none;
}

.ui-search-cancel {
    display: none;
    position: absolute;
    top: 50%;
    right: 0;
    -webkit-transform: translate3d(0, -50%, 0);
    transform: translate3d(0, -50%, 0);
    width: 16%;
    font-size: 16px;
    text-align: center;
    color: #858585;
}

.ui-search-reset {
    display: none;
    position: absolute;
    top: 50%;
    left: 78%;
    -webkit-transform: translate3d(0, -50%, 0);
    transform: translate3d(0, -50%, 0);

    background-color: #858585;
    color: #fff;

    border-radius: 14px;

    width: 14px;
    height: 14px;
    font-size: 14px;
    line-height: 10px;
    text-align: center;
}

.ui-search.js-focus .ui-search-cancel {
    display: block;
}

.ui-search.js-focus .ui-search-form {
    width: 86%;
}

/* TODO: reset button */
.ui-search.js-input .ui-search-reset {
    display: block;
}

/* /SearchBar */

/* Tab */

.ui-tab {
    display: none;
}

.ui-tab.js-active {
    display: block;
}

/* /Tab */


/* Dialog */

/* container to scroll within */
.ui-dialog {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: none;
    z-index: 10000; /* Larger then the z-index value of .ui-backdrop class */
    overflow: auto;
    overflow-y: scroll;
}

/* /Dialog */

/* Backdrop */
.js-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    visibility: hidden;
    background-color: #000000;
    display: block;

    /*
     Only add a transitional effect for opacity property
     avoid emulate position fixed trigger transitional effect on height
    */
    -webkit-transition: opacity 200ms;
    transition: opacity 200ms;

    z-index: 9999;
}

.js-backdrop.js-effect-fade {
    opacity: 0;
}

.js-backdrop.js-show {
    visibility: visible;
    opacity: .5;
}

/* /Backdrop */

/* ActionSheet */

.ui-actionsheet {
    width: 100%;
    padding: 0 8px;
    border: 0;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;

    position: absolute;
    bottom: 0;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);

    -webkit-transition: 200ms ease-in-out;
    transition: 200ms ease-in-out

    visibility: hidden;

    backface-visibility: hidden;
}

.ui-dialog.js-show > .ui-actionsheet {
    opacity: 1;
    visibility: visible;

    -webkit-transform: translate3d(0, 0, 0) scale(1) !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
}

.ui-actionsheet li, .ui-actionsheet-cancel {
    display: block;
    list-style-type: none;

    color: #007AFF;
    font-size: 18px;
    line-height: 28px;
    text-align: center;
    background-color: #ECECEC;

    padding: 6px 0;
    border-bottom: 1px solid rgba(180, 180, 180, 0.5);
}

.ui-actionsheet li:first-child {
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
}

.ui-actionsheet li:last-child {
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
}

.ui-actionsheet-cancel {
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
    margin: .5em 0;
}

/* /ActionSheet */


/* Alert */

/* positioning shell for the actual modal */
.ui-alert {
    border-radius: 10px;
    width: 280px;

    position: absolute;
    top: 50%;
    left: 50%;

    -webkit-transform: translate3d(-50%, -50%, 0);
    transform: translate3d(-50%, -50%, 0);

    opacity: 0;

    /* visibility: hidden; */   /* I don't know why on iOS 4.3 visibility: visible is not work */

    backface-visibility: hidden;
    background-color: #ECECEC;

    -webkit-transition: 300ms;
    transition: 300ms;

}

.ui-dialog.js-show > .ui-alert{
    opacity: 1;
    visibility: visible;

    -webkit-transform: translate3d(-50%, -50%, 0) scale(1) !important;
    transform: translate3d(-50%, -50%, 0) scale(1) !important;
}

.ui-alert-header,
.ui-alert-footer {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
}

.ui-alert-header {
    margin-top: 15px;
}

.ui-alert-title {
    position: static;
    text-align: center;
    width: 100%;
    font-size: 18px;
    font-weight: 500;
    margin: 0;
}

.ui-alert-body {
    margin: 15px;
    font-size: 14px;
    text-align: center;
}

.ui-alert-footer {
    width: 100%;
    padding: 0;
}

.ui-alert-button {
    display: block;
    max-width: 280px;
    width: auto;
    margin: 0;
    padding: 8px 0px;
    border: 0;
    border-top: solid 1px #b5b5b5;

    -webkit-box-sizing: border-box;
    box-sizing: border-box;

    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;

    position: relative;

    font-weight: 300;
    font-size: 18px;
    line-height: 30px;
    overflow: hidden;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;

    color: #167efb;
    background-color: rgba(255, 255, 255, 0.01);
    transition: background-color .1s ease-in-out;
}

.ui-alert-button + .ui-alert-button {
    border-left: solid 1px #b5b5b5;
}

/* /Alert */

/* Notify  TODO */
.ui-notify {
    border: 0;
    border-radius: 0 0 5px 5px;

    position: absolute;
    top: 0;
    left: 10px;
    right: 10px;

    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);

    -webkit-transition: 300ms ease-in-out;
    transition: 300ms ease-in-out;

    /*visibility: hidden;*/  /* I don't know why on Android 4.0.3 visibility: visible make it not work */
    backface-visibility: hidden;

    opacity: 0;

    background: rgba(0, 0, 0, 0.5);

    color: #fff;
    font-size: 14px;
    line-height: 40px;
    text-align: center;
}

.ui-dialog.js-show > .ui-notify {
    opacity: 1;
    visibility: visible;

    -webkit-transform: translate3d(0, 0, 0) rotateX(0deg) !important;
    transform: translate3d(0, 0, 0) rotateX(0deg) !important;
}
/* /Notify */

/* Carousel */
.ui-carousel {
    position: relative;
    -webkit-transform: translate3d(0,0,0);
}

.ui-carousel-inner {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.ui-carousel-item  {
    position: relative;
    display: none;
    -webkit-transition: .5s ease-in-out left;
    transition: .5s ease-in-out left;
    z-index: 9;
    -webkit-transform: translate3d(0,0,0);
}

.ui-carousel-inner > .js-show,
.ui-carousel-inner > .js-active,
.ui-carousel-inner > .js-next,
.ui-carousel-inner > .js-prev {
    display: block;
}

.ui-carousel-inner > .js-active {
    left: 0;
    z-index: 10;
}

.ui-carousel-inner > .js-show,
.ui-carousel-inner > .js-next,
.ui-carousel-inner > .js-prev {
    position: absolute;
    top: 0;
    width: 100%;
}

.ui-carousel-inner > .js-next {
    left: 100%;
}

.ui-carousel-inner > .js-prev {
    left: -100%;
}
.ui-carousel-inner > .js-next.js-left,
.ui-carousel-inner > .js-prev.js-right {
    left: 0;
}
.ui-carousel-inner > .js-active.js-left {
    left: -100%;
}

.ui-carousel-inner > .js-active.js-right {
    left: 100%;
}

.ui-carousel-indicators {
    z-index: 11;
    position: absolute;
    bottom: 10px;
    left: 50%;
    width: 60%;
    padding-left: 0;
    margin-left: -30%;
    text-align: center;
    list-style: none;

    -webkit-transform: translate3d(0,0,0); /* Hack for android 4.0 that indicators not display */
}

.ui-carousel-indicators li {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 1px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
}

.ui-carousel-indicators li.js-active {
    background-color: #fff;
}
/* /Carousel */

/* Effects */

/* For Alert */

.js-effect-from-below .js-dialog-content.ui-alert {
    -webkit-transform: translate3d(-50%, -50%, 0) scale(.5);
    transform: translate3d(-50%, -50%, 0)  scale(.5);
}

.js-effect-from-above .js-dialog-content.ui-alert {
    -webkit-transform: translate3d(-50%, -50%, 0) scale(1.5);
    transform: translate3d(-50%, -50%, 0) scale(1.5);
}

.js-effect-from-bottom .js-dialog-content.ui-alert{
    -webkit-transform: translate3d(-50%, 0, 0);
    transform: translate3d(-50%, 0, 0);
}

.js-effect-from-top .js-dialog-content.ui-alert {
    -webkit-transform: translate3d(-50%, -100%, 0);
    transform: translate3d(-50%, -100%, 0);
}

.js-effect-from-right .js-dialog-content.ui-alert {
    -webkit-transform: translate3d(0, -50%, 0);
    transform: translate3d(0, -50%, 0);
}

.js-effect-from-left .js-dialog-content.ui-alert {
    -webkit-transform: translate3d(-100%, -50%, 0);
    transform: translate3d(-100%, -50%, 0);
}

/* For ActionSheet */

.js-effect-from-bottom .js-dialog-content.ui-actionsheet {
    -webkit-transform: translate3d(0, 100%, 0);
    transform: translate3d(0, 100%, 0);
}

/* For Notify */
.js-effect-from-top .js-dialog-content.ui-notify {
    -webkit-transform: translate3d(0, -100%, 0);
    transform: translate3d(0, -100%, 0);
}

.js-effect-drop-down .js-dialog-content.ui-notify {
    /* Set origin for drop down effect */
    -webkit-transform-origin: center top;
    transform-origin: center top;

    -webkit-transform: rotateX(-90deg);
    transform: rotateX(-90deg);
}
